import { Injectable } from '@nestjs/common';
import { MailerService } from '@nestjs-modules/mailer';
// import configuration from 'src/config/configuration';

@Injectable()
export class MailService {
  constructor(private readonly mailerService: MailerService) {}

  async sendMail(to: string, subject: string, text: string): Promise<void> {
    await this.mailerService.sendMail({
      to,
      subject,
      text,
      html: `
      <div >
          <p> 验证邮箱为<b>${to}</b> 。
          验证码为：</p>
          <p style="color: green;font-weight: 600;margin: 0 6px;text-align: center; font-size: 20px">
            ${text}
          </p>
      </div>
  `,
    });
  }
}
